/**
 * Author  zxy
 * Date  2023/6/21 下午 3:42
 */
public class LRU {
    DoubleLinked list;

    LRU() {
        list = new DoubleLinked();
    }

    public void addData(String data) {
        Node node = new Node(data);

        if (list.head == null) {
            list.addHead(node);
        }
        else {
            Node temp = list.head;
            while (temp != null) {
                if (temp.data.equals(data)) {
                    temp.next.pre = temp.pre;
                    temp.pre.next = temp.next;
                }

                temp = temp.next;
            }
        }
    }

    public void del () {
        list.delTail();
    }
}

